/**
 * 文件描述如下：
 * 1. 设备驱动页面的数据
 */

// 处理交通流量页面的数据
const data_1 = {
  title: 'limit',
  data: [
    { id: 0, key: 'cpu-occupancy', parentNode: 'limit', name: '用于判断CPU占用率过高', showType: 'input', inputType: 'double' },
    { id: 1, key: 'cpu-temperature', parentNode: 'limit', name: '用于判断CPU温度过高', showType: 'input', inputType: 'double' },
    { id: 2, key: 'disk-free-rate', parentNode: 'limit', name: '用于判断磁盘不足', showType: 'input', inputType: 'double' },
    { id: 3, key: 'gpu-occupancy', parentNode: 'limit', name: '用于判断GPU占用率过高', showType: 'input', inputType: 'double' },
    { id: 4, key: 'gpu-temperature', parentNode: 'limit', name: '用于判断GPU温度过高', showType: 'input', inputType: 'double' },
    { id: 5, key: 'hb-lost-count', parentNode: 'limit', name: '用于判断组件丢失的最大心跳次数', showType: 'input', inputType: 'uint' },
    { id: 6, key: 'mem-free-rate', parentNode: 'limit', name: '用于判断内存不足', showType: 'input', inputType: 'double' },
  ],
}

const data_2 = {
  title: 'monitor',
  data: [
    {
      id: 0,
      key: 'nic',
      parentNode: 'monitor',
      name: '用于设置监控的网卡（路云通信需求）',
      showType: 'input',
      inputType: 'text',
    },
  ],
}

export const dataProcessing_operation = (params) => {
  if (!params) return
  // 头部的块
  data_1.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })

  data_2.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })

  return { data_1, data_2 }
}
